package com.itlong.cloud.property.resource;

import com.itlong.cloud.POJO.DTO.property.PropertyEquipRecordGetDTO;
import com.itlong.cloud.POJO.VO.property.PropertyEquipRecordGetVO;
import com.itlong.cloud.equip.property.IPropertyEquipRecordServiceClient;
import com.itlong.cloud.property.service.IPropertyEquipRecordService;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <desc>
 *      通行记录暴露接口实现类。
 * </desc>
 *
 * @createDate 2017/10/11
 */
@RestController
public class PropertyEquipRecordServiceResource implements IPropertyEquipRecordServiceClient {

    @Autowired
    IPropertyEquipRecordService iPropertyEquipRecordService;

    /**
     * <desc>
     *      分页查询电梯通行记录
     * <desc/>
     * @param   propertyEquipRecordGetDTO   通行记录查询DTO
     * @return  List<PropertyEquipRecordGetVO>
     * @author Biao.R
     * @createDate 2017/10/10
     */
    @PostMapping(path = "/getEquipRecordByPage")
    public Page<PropertyEquipRecordGetVO> getEquipRecordByPage(@RequestBody PropertyEquipRecordGetDTO propertyEquipRecordGetDTO) throws Exception {
        return iPropertyEquipRecordService.getEquipRecordByPage(propertyEquipRecordGetDTO);
    }

    /**
     * <desc>
     *      查询项目中的云对讲数量
     * <desc/>
     * @param  projectId    待查询的projectId
     * @return 该项目的云对讲通行纪录数量
     * @author Biao.R
     * @createDate 2018/1/12
     */
    @PostMapping(path = "/countCloudRecordByProjectId")
    @Override
    public Integer countCloudRecordByProjectId(@RequestParam("projectId") String projectId) {
        return iPropertyEquipRecordService.countCloudRecordByProjectId(projectId);
    }

    /**
     * <desc>
     *     将通行记录中开门方式为动态密码和二维码的旧数据迁移到访客通行记录表中
     * <desc/>
     *@param  propertyEquipRecordGetDTO  分页查询通行记录
     * @return  MessageVO 标准格式化响应结果
     * @author Juguang.S
     * @createDate 2018/08/13
     */
    @PostMapping(path = "/getVistitorInfo")
    public void getVistitorInfo(@RequestBody PropertyEquipRecordGetDTO propertyEquipRecordGetDTO) throws Exception {
        iPropertyEquipRecordService.getVistitorInfo(propertyEquipRecordGetDTO);
    }

    /**
     * <desc>
     *      查询项目收费模式
     * </desc>
     *
     * @param projectId
     * @return
     * @author Jiaqi.X
     * @createDate 2019/10/23
     */
    @PostMapping(path = "/searchProjectChargeModel")
    public Integer searchProjectChargeModel(@RequestParam("projectId") String projectId){
        return iPropertyEquipRecordService.searchProjectChargeModel(projectId);
    }
}